#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  multi_first.py
#       Author @  Huoty
#  Create date @  2016-05-27 15:46:31
#  Description @  
# *************************************************************

import time
from multiprocessing import Process, current_process

def worker():
    name = current_process().name
    print name, "starting."
    time.sleep(2)
    print name, "exiting."

def service():
    name = current_process().name
    print name, "starting."
    time.sleep(3)
    print name, 'exiting.'

# Script starts from here

if __name__ == "__main__":
    pservice = Process(name="My_service", target=service)
    worker_1 = Process(name="Worker1", target=worker)
    worker_2 = Process(target=worker)

    worker_1.start()
    worker_1.join()
    worker_2.start()
    pservice.start()
